# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Mosra <mosra@centrum.cz>

# An up-to-date version of this PKGBUILD is maintained at
# https://github.com/mosra/magnum/blob/master/package/archlinux/magnum/PKGBUILD

pkgname=magnum
pkgver=2020.06
pkgrel=1
pkgdesc='C++11/C++14 graphics middleware for games and data visualization'
arch=(x86_64)
url='https://magnum.graphics'
license=(MIT)
depends=("corrade>=$pkgver" openal glfw sdl2 vulkan-icd-loader)
makedepends=(cmake git ninja)
optdepends=('magnum-plugins: import and export features')
source=("git+https://github.com/mosra/magnum.git#tag=v$pkgver")
sha256sums=('SKIP')

build() {
  mkdir -p build
  cd build
  cmake "$srcdir/magnum" \
    -DCMAKE_CXX_FLAGS="$CXXFLAGS -Wfatal-errors" \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DMAGNUM_WITH_AL_INFO=ON \
    -DMAGNUM_WITH_ANYAUDIOIMPORTER=ON \
    -DMAGNUM_WITH_ANYIMAGECONVERTER=ON \
    -DMAGNUM_WITH_ANYIMAGEIMPORTER=ON \
    -DMAGNUM_WITH_ANYSCENECONVERTER=ON \
    -DMAGNUM_WITH_ANYSCENEIMPORTER=ON \
    -DMAGNUM_WITH_AUDIO=ON \
    -DMAGNUM_WITH_DISTANCEFIELDCONVERTER=ON \
    -DMAGNUM_WITH_GLXAPPLICATION=ON \
    -DMAGNUM_WITH_GLXCONTEXT=ON \
    -DMAGNUM_WITH_IMAGECONVERTER=ON \
    -DMAGNUM_WITH_SCENECONVERTER=ON \
    -DMAGNUM_WITH_SHADERCONVERTER=ON \
    -DMAGNUM_WITH_MAGNUMFONT=ON \
    -DMAGNUM_WITH_MAGNUMFONTCONVERTER=ON \
    -DMAGNUM_WITH_OBJIMPORTER=ON \
    -DMAGNUM_WITH_FONTCONVERTER=ON \
    -DMAGNUM_WITH_GL_INFO=ON \
    -DMAGNUM_WITH_GLFWAPPLICATION=ON \
    -DMAGNUM_WITH_SDL2APPLICATION=ON \
    -DMAGNUM_WITH_TGAIMAGECONVERTER=ON \
    -DMAGNUM_WITH_TGAIMPORTER=ON \
    -DMAGNUM_WITH_VK=ON \
    -DMAGNUM_WITH_VK_INFO=ON \
    -DMAGNUM_WITH_WAVAUDIOIMPORTER=ON \
    -DMAGNUM_WITH_WINDOWLESSGLXAPPLICATION=ON \
    -GNinja
  ninja
}

package() {
  DESTDIR="$pkgdir" ninja -C build install
  install -Dm644 magnum/COPYING \
    "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}

# getver: github.com/mosra/magnum/releases/latest
# vim: ts=2 sw=2 et:
